package interviewProgram50._7_charNumbers;

import java.util.Scanner;

/**
 * @author 许群星
 * @decription
 * @data 2020/2/1721:12
 **/
public class CharNumbers2 {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        System.out.println("请输入字符串:");
        String string=scanner.nextLine();
        scanner.close();

        char[] charArry=string.toCharArray();
        int countLetter=0,countNumber=0,countSpace=0,countOther=0;
        for (int i = 0; i < charArry.length; i++) {
            if (charArry[i]>=65 && charArry[i]<=90 ||charArry[i]>=97&&charArry[i]<=122)
                countLetter++;
            else if (charArry[i]>=48&&charArry[i]<=57)
                countNumber++;
            else  if (charArry[i]==' ')
                countSpace++;
            else
                countOther++;
        }
        System.out.println(string+"中有"+countLetter+"个字母，"+countNumber+"个数字，"+
                countSpace+"个空格，"+countOther+"个其他字符");


    }
}
